
	vb41Cx 2002-18 Ron van Tilburg, (rivit@tpg.com.au)
	===============================================

 README: Version 4.4.4   08.06.2018 

This is a full simulation (i.e. machine as a blackbox - not emulating the CPU) with extensions, written in VisualBasic .NET, of the Hewlett Packard HP41C calculator first released in 1979. For instructions on How to use the calculator any HP user manual will do, but the crux of operation is in the Help Directory as a quick reference manual which is a crib of the instruction card first issued with it. Bits of the instructions are Copyright HP, which I've adapted to this machine. 

Prior to version 4.0 The Program was released with source under the GPL license. I retained all commercial rights, but you have the right to distribute and even modify under certain constraints. See the License file.

V4.1 and later will probably only consist of an executable and required data files as I'm thinking of releasing it as a tablet product. 

Font mods are entirely my copyright and their source is not made available as a consequence

A fully prepared zip VB41CXvwcc.zip, and further extensions are available at www.hp41.org, a site entirely dedicated to knowledge of this brilliant machine 

--------------------------------------
A REQUEST:
--------------------------------------
I have, to date, received very little feedback on this project (really, just a handful of contacts in 10 years). I'd love to know if its actually ever used... is it correct, am I mad... I could do with some enthusiastic testers and inventors, and code cutters.

This simulation is not restricted to/by HP MCODE (that has its own emulation challenges) and can therefore evolve freely - it just needs interest 
and effort. If you can competently use .NET in any form, MONO or the like, on PCs or on other platforms this product could go everywhere...

--------------------------------------
VB PROGRAMMERS NOTES:
--------------------------------------
This is a pretty advanced modular program all up (even though its not particulary object-oriented in its structure). It demonstrates how to structure code to be essentially relocatable (so that Callback can be used and modules arbitrarily loaded into memory), two parsers - keystroke, and program editor, - as well as some tricks to interleave timers, executing programs and keyboard into one. I also had to invent a couple of fonts, and figure out how to override the slow GDI+ graphics in windows. I own a real HP41CX having bought it in 1981, and still use it. Making the printer look like a real HP printer was also fun. The new PAGE device has enabled me to find a good use of the work I had much earlier done with the MS Windows GFX subsystem. 

During 2011, as a learning exercise in VB.NET the VB6 was converted and ran pretty much straight away - I was lucky. However, (and this note is a year later), I have found a number of flaws in the 4.0 version (many caused by behavioral differences bewteen VB6 and VB.NET), and I am withdrawing the source until I am sure I can live with it being public again.... Since writing the aforegoing I have been through the code like a dose of salts and it is much more solid now - however I'll stand by it only after a release (v4.2) survives without fatal flaws. Once burnt - twice shy.

Here with 2012 nearing its end, v4.2 still had more than enough surprises, some self inflicted, although fortunately none as to be fatal. 

Now Jun 2018 this version 4.4.3 is a substantial improvement incorporating all functional fixes found (about a dozen - thanks folks) since 4.3 and considerable effort to make it DPI sensitive - the gui is now scalable at user discretion. This should help with displays on handheld windows devices (tablets) that operate at higher than 96 DPI, but even for those with bigger fingers there is now a way to make the machine bigger. The other main development is the completion of the XR26 TIMER module - including stopwatches and timers. 

--------------------------------------
ACKNOWLEDGEMENTS:
--------------------------------------
Without the work that others have done I could not have advanced this project - in particular people who have contributed to hp41.org (also thanks to Warren Furlow for encouragement and hosting) have been my biggest help - and the documentation there posted. Those who have commented or contributed bug fixes or prods to keep going - thank you.

--------------------------------------
DISTRIBUTION FILES
--------------------------------------

The entire distribution is:
VB41CXvwcc.zip	the zip			(www.hp41.org)

 where vwcc is the Major/Minor/Compile version eg 4.0.1.32

A fully implemented installation should look like this

...  RVTVB41CX_v.w			'main directory
	 /BIN
		*.exe			'where I keep HPuc etc - delivered empty
	 /DOCO
		*.*			'Where I keep various documentation - delivered empty
	 /FONTS
		*.ttf
	 /HELP
		.doc			'The Quick Ref
	 /MSVOLUMES			'delivered empty
		*.msv
	 /PROGRAMS			'delivered empty
		*.raw
		*.txt
	 /ROM
		*.rom			'delivered empty
	 /SRC				'from v4.0 on delivered empty
		*.bas
		*.frm
		*.txt
	 /STATEFILES
		autoxrom.txt
		*.cod
		*.dat
	.all of the executables
	
--------------------------------------
INSTALLATION
--------------------------------------
Unzip this file into a directory, should be Unzipped using full paths

If you are updating an existing installation then install the new one and move your doco, programs etc into the corresponding directories.
Do not overwrite the Fonts,Help,Statefiles directories.

The executable is ready to run, and requires only the VB.NET 2.0 runtimes, which almost everyone on Windows will now have.

To RUN: Doubleclick the exe or its Icon , which can be shortcutted to the desktop

[You may need to put the fonts into Windows:Fonts as vb.NET sometimes cannot or will not load them the way I intend.
[The fonts are loaded in the program - but I've found it temperamental on different platforms)

--------------------------------------
OPERATING SYSTEM COMPATIBILITY
--------------------------------------
Do not expect it to run on any platform that cannot support MS .NET

It has been tested and run successfully on
- Windows 98 Second Edition  version 1,2,3
- Windows XP - SP1,SP2, SP3  all versions under VB or VB.NET

vb41Cx .NET (v4.0 and later) has been verified on the following:
Win XP SP3, Vista, Win 7, Win8, Win8.1, Win10

v4.3 and later, Windows 10, 4.4 right up to Win10 1803 and it should still run on XP.

I have verified that it runs correctly on (touchscreen) tablets running a full Windows OS. All functionality worked out of the box. (to my amazement no special things for tablets). The new rescale is quite handy. Landscape Orientation is OK in all modes, Portrait orientation does work but looks weird in full screen. 

Perhaps it may one day run under MONO on various non MS platforms as I have not used anything beyond .NET 2.0 (and not much fancy at that)
--------------------------------------
RELEASE HISTORY
--------------------------------------
 08 Jun 2018 4.4.4 6th Public Release. 15 years on! HP41c will be 39 and I will be 64 soon
 
		This release is finally complete - its important to note that this is a REINSTALL as quite a few things have changed. 
		
		Install in a different place than your current version (if you're not starting from scratch)
		Move across - all of your own saved content files - be it Programs, Mass Storgae files, Documentation etc. into their respective folders
		
		Formats between versions have remained constant, but some files are volatile (ie your content is in them)
		If you have saved/backedup everything in the machine you can carry on
		else
		In the Statefiles copy the following files across from your previous setup 
			VB41.cfg								'this says which modules are to be loaded at startup
		  vb41c.COD								'this is the main memory of the vb41
			XR25 Ext Fn.COD					'this is the extended memory of the vb41
			XR28 Mass Storage.COD
			
		Check that the XR26 Time Module has the date 8 Jun 2018 - it must be 1792bytes long, the previous one will cause the machine to loop.
			
			
 25 Dec 2017 4.4.1 Enhancements,Fixes 
	  
		The source code has been pretty packaged as "VB41CX - The Book". I've done it this way as documentation so that those interested can see how I've tackled the project over the years, for didactic purposes; I'm sure good and bad programming practices can be found, and just as a way of understanding how the VB41CX achieves its behaviour. It will probably help you see where I've not got it right, and makes for an interesting comparison (at times) with the VASM listings of the original. It's somewhat surprising to me to see how when the data structures are common, that the code often takes a similar approach even in different languages. The material admits a procedural style of programming - obviously in assembly this is much terser. I can also see which areas I struggled with as the code is not nearly as compact or clear as it could be in those parts (the just get it working syndrome). Hope you can enjoy it as a slow read, and maybe put it to some use.
		
		Added: Whole display is now Scalable to account for finer displays ie high DPI displays.
		when the machine is turned off (whether small or maximized the following keys have effect
			+ the PLUS key makes the display bigger in 25% increments from 1x to 4x
			- the MINUS key makes the display smaller in 25% increments from 4x to 1x
		
		You'll have to use commonsense here - it is possible to scale too big - but it looks great.
	
		This Scaling setting is stored between sessions so you probably only need to do this once.
	  The print page was always scalable by zooming, and dragging - the printerstrip is now autoscaled.
	  Enhanced: Graphics items - images, fonts etc. for the machine have been overhauled for the best representation at all resolutions. 
				
		Fixed: to some extent by radically simplifying the GUI a great deal, lag and flashing on resize and on/off.
		To be frank I still haven't cracked this entirely - windows does not like independent windows management - on/off fixes graphics glitches. 

		Completed: XROM26 TimeModule
		Stopwatch and Alarms are all now in place. Stopwatch is limited to max 100 registers for time splits. Precision is at best 0.20 sec but reaction times are of this order anyway (original Time Module was 0.07s, V41 0.13-0.2). Alarms are stored in XROM memory in the form of the old HP Buffers but do not use main memory. They can still be recalled with RCLALM as before. The functionality of Alarms is diabolically complex and I cannot be sure it all works as it should - but I gave it a good fling. Time module has grown from 26 to 256 Registers to store alarms.
		
	*	Enhanced: the loading of ROMS with RROM and RROMX code. It is now more bulletproof and can frequently extract user code disguised as a MC 	Function. Also WRCODA now knows more about how to write AutoXROMS and .COD images of ROMS. The COD Image of a ROM is now a closer representation of the original. All CODS have been reviewed and revised. 

		Enhanced: Loading data/programs from other than default paths will now be remembered and is path absolute. Relative paths were sometimes wrong.
			
		Added: an internal expansion MCLIB4 in the style (echo) of Angel Martins LIB4 has been added to cater for the multiple uses of many routines of his ROMs. This ROM is invisible to users, but is callable internally, and its routines can be co-opted by other XROMS as if they were their own.
		This is a useful way of extending functionality - but I'm still of two minds about trying to support AMs modules, despite the fact that they have many attractive functions and features. I am unable to reach him to discuss my thoughts.

		Enhanced: Up Arrow works as BST = SHIFT SST in Catalog Listing Functions

		Enhanced: SHIFT PRGM takes you to the last program in memory and toggles PRGM mode
							GTO . PRGM takes you to the first program in memory and toggles PRGM mode

		Enhanced: If you lose Key assignments for some reason because RegR or Rege were clobbered by your experiments then putting 						FF.FF.FF.FF.FF.FF.FF into these registers and turning the machine off and on with restore their display correctly. Won't do anything for you if you've lost the assignments themselves!
	
		Enhanced: the .,:; characters are now half width display characters and therefore its now possible to have 24 displayed without scrolling. This makes the display act more like the original, but I do not leave this half space between all characters

		Fixed: Display for lines longer than 16 chars in edit mode used to overly scroll - now it acts more like the original, scrolling only twice in total, as it is entered one char at a time, and once on ALPHA off. This makes data entry a lot easier.
 
		Fixed: a number of binary functions in extension ROMS (using X and Y) that lower the stack would give inconsistent results if the stack had been disabled by ENTER or CLx.  The Y register was not being dropped to X before X was overwritten with the result. Most notably Printer - BLDSPEC, and functions in RVTUtils - MINSR, SHFYX and ROTYX and some in PANAME and ADV rom so quite possible you never noticed.
	
		Enhanced: PRCE (PRint Catalog Entry) does a better job of describing attributes of a function.

		Fixed: PPRP with "*" in ALPHA to print ALL programs in memory - including those with no labels other than an END. Formerly would stop in error at first program without a global label, which was not by design. 
	
		Fixed: XCAT nn will now stop at and display the first Catalog Entry after requested Romnr. Used to keep going until end of the catalog which was wrong. Still havent figured out how to stop it one line earlier.
		
		Fixed: XTOA while functionally working correctly would flash a ALPHA DATA error msg if X was ALPHA  
		
 26 Aug 2017 4.3.13.0 BugFixes - this zip contains just the exe and all of the fixes before the 4.4 version - copy it over your existing RVTvb41c.exe
			
		Fixed Display handling at END or RTN - AVIEWed or VIEWed Display retained until first key touched (bT from France)
		
 12 Jul 2016 4.3.12.0 A General Bugfix Release 
		Fixed filename handling on RTXTP and RTXTS which would fail to read a program file in TXT format (Roberto Arancio)
 
 12 Dec 2015 4.3.11.0 New Border on form to handle Windows 10 reinterpretation of what a window should look like/
 
  5 May 2015 4.3.1.0 - to distribute the fixes since v4.3 in Dec 2012 - time does march on - this thing has been evolving for 27 years 
	
		Fixed format of CLOCK when in CLK24 mode - was not showing 13.00.00-23.5959 (Chris Bice)

		Fixed ACYX printer function which would not pad with spaces if x was <0 (Chris Bice). X=0 will print Y verbatim rather than give an error
		Function is sensitive to Format flags FIX nn,SCI nn,ENG nn

		Modified behaviour of PSE (PSE clears Display of VIEW or AVIEW on completion Chris Bice)). Will now leave previously VIEWed or AVIEWed values
		in display. Also PSE in a program will blink the PRGM annunciator once as HP41 does. However it is NOT possible to input data during a PSE
  		R/S will stop execution for input if necessary.

 6 Apr 2014  4.3.0.6 Bug Fix for incorrect string compare between two registers e.g. "A" ASTO Y "B" ASTO X x=y? ==> YES when should have been NO 
		found by Dr. Jackie F. Woldering. Feeling suitably embarassed. Please check your string register compares. Also later reported multiple times by others. 
		All string compares of strings of equal length were faulty if they only differed at the last character,.

 6 Mar 2013 	4.3.0.1 Bug fix for HR and minute arguments of 18 which were leading to truncation errors inside (thx Chris Bice)
		Bug fix for parsing keystrokes for ARCL,ASTO IND nn which were reverting to ARCL 99 and STO 99 

 16 Dec 2012	v4.3.0.0 5th Public Release (Exe Only)

		In summary bugfixes, new functions, ROM enhancements - a fairly productive few weeks so its a long update log (sorry)

	GUI
		Fixed: Patched up x,y comparison shifted function labels to lowercase
		Fixed: Properly display Not Equal and Sigma symbols in shifted function labels
		Fixed: When displaying on devices with DPI<>96 make sure fonts are a fixed PIXEL size not a fixed POINT size
		Added: Changed the assign label colour from YELLOW to GREEN for Program ALPHA LBLs either CAT1 or CAT2
		Added: SHIFT USER(in USER Mode) will put the machine into an extended USER mode (USER*) 
			where Local Labels if they exist will have precedence over assigned functions. 
			USER on its own has the precedence Assignment, Local Label
			LOCAL Label tags are shown A,a above the A Key or whatever their values have been set to. They are LILAC in colour. 
		Added: A new experimental programmable function in XR27 to manage tags on the upper two key rows for local labels
		 	(S)et(L)ocal(L)abel(T)ag in the form SLLT n to change those labels on the keyboard 
			this takes the ALPHA value in format :ttt:ttt:ttt:ttt:ttt for each label named if : or empty clear the tags
			e.g. ":::ttt"  for SLLT 1 would set LBL A="" LBL B="" LBL C="ttt" LBL D="" LBL E=""
			alpha will be reformatted with the : replaced by space for potential prompts
			SLLT 0 will Clear Local label Tags - will put these label tags back into A,B,C etc...
			SLLT 1 - Row A,B,C,D,E
			SLLT 9 - Row a,b,c,d,e
			SLLT 2 - Row F,G,H,I,J - all other values will reset (clear) the Local Label Tags (as for 0)
		Fixed: Assignment Tags are now reinitialised after a config change as ROMs may have changed and the references remain in assignments.
			This affects the display of ROM functions. if a ROM is no longer configured then its assignments will appear as XROM. 
			Previewing that key or CAT 6 will show XROM nn,mm where nn was removed, and nn is the index of the function in that ROM. 
	CORE	
		Fixed: When using Flag25 to catch errors function execution is now shortcut to not update result registers (as it should) (bug from 3.1)
		Added: SHIFT PRGM will edit from line 1 of the last program in memory (the one with .END.) and sets the PC there
		       PRGM on its own edits from current PC.
		Fixed: After a Config change the program pointer will go to the top of the program with the .END.. This prevents a bug where if the 
			module pointed into is removed the machine will lock into an endless error loop.
		Fixed: DSE to skip when EQUAL (or LESS THAN) rather than just EQUAL		(bug dates from v3.1)
		Fixed: MOD (Again!!!) Now matches HP41 when x=0 as well...			(bug dates from v4.2)
		Fixed: SIGN to return 0 when x contains ALPHA DATA not the Error ALPHADATA	(bug dates from v3.1)
		Fixed: SUMREG did not account for Reg00 anymore - bug introduced with v4.2 speedups...:-[
		Fixed: OCT 1073741823 would fail due to scanning FP precision 
		Fixed: RTN when stopping will now restore the display to X or ALPHA as it should. STOP may not..
		Fixed: Immediate Display of Comparisons was reversed (YES<>NO), values were actually correct in programs (bugged when fixing DSE)
		NOTE:  Unlike the 41C you will not get an ALPHADATA error in comparisons (as for x cmp NN ?) -number < 0 <= +ve number < text (NAN) alphabetical
		Fixed: TEXT entry now frees the stack (before it ignored it) eg. 3 ENTER "ABC" 2 gives x=2,y=3,z=3,T but 3 ENTER 2 gives x=2,y=3, ZT
		Fixed: Assignment of Function to a key that had a program assigned would not clear the program Key Byte. 
		Fixed: The first program in memory could be executed with Local Labels even if they were in some later CAT1 program - fixed a loop end condition 
		Revised: Speedups/Tuning for RDN,RUP,PI,ABS,CHS and SIGN
		Revised: The entire sound Engine has been revised. See XROM19 below
		Added: new not programmable function XCAT nn will do catalog 2 processing for XRom number nn, provided it is configured (loaded) 
		Added: Setting F20 - Enhances CAT n where n=1,2,3,4,5,6,7 will directly print the catalogs if also F21 is SET. 
		 	In some cases more detail is given - they are very quick and not interactive
		Fixed: any instruction updating Regb (ie the Program Counter) would fail to cause a jump to that address in SST and RUN modes - now fixed.
	
	ROMS	
		XR19 RVT SYNTH
			The entire sound Engine has been revised. My intent was to be correct in pitch and match the range of a guitar, from Dropped D 
			Tuning up. It now contains a 256 value 4 octave,5 duration synth table, with support for elementary wave envelopes on Square, 
			Sawtooth, Sinus and Triangular waveforms, with duration adjustment, chords and arpeggios.
			It can be played as a stream of bytes or with the dedicated functions. There is a 0.05s overhead under .NET for playing a note
			- this interferes with playing notes really quickly, but the arpeggio joins the notes together before playing them.

			TONE 0-9 are as on HP41C (made as a subselection of the larger synth table), all native notes 0-255 can be played with 
			the NOTE IND .. or the NOTESA (ALPHA STRING) instruction. 
						
			Tones 05-0F are control tones that affect the setup of the synth, and Notes 0-4 play? silence of varying length.
			First octave block starts at D2(x10) and runs to C#6(x3F), reference A440 at x2F, next block 40-7F etc. 
			Blocks play notes for 1/8s,1/4s,1/2s,1s,2s nominally (depends a little on time to create note)
			The Synth functions are provisionally added to this new module with JM Baillards chord program which sounds really good 
			I expect in time to add a little support for playing XMEM buffer files and easy guitar tabs 
			In the Help directory is a small GIF showing the synth table and its values - as I havent documented this module yet
			you can have some fun trying to decipher it, and make BEEP sound completely different. 

		XR29 PRINTER
		Fixed: 	FMT now centres output correctly when FMT used first and last on a line
		Fixed:	PRXFL now fails a little more gracefully on formats its not yet ready for, SF00 will always print a hex dump of the file

		XR30 CARDREADER -SEE ALSO SPECIAL NOTES
		Fixed:	RTXTP,RTXTS now correctly parse LBL "ABC" to LBL`ABC not LBL`"ABC".  	- a version 3.3 bug
			also now ALL statements at the start of a text line will be processed except #... which is a comment. 
			nn #... will be accepted as TEXT "#..." so needs to be removed afterwards. Things like 21'TEXT will also become "21'TEXT"
			This way the parse will always complete - listing the program will quickly show any oddities. However it means you can
			inadvertently load a real non program txt file...
		Changed: RAS and WAS have been renamed RTXTA and WTXTA to better describe them - functionality has not changed
		Changed: RROM, RROMR, RROMX, WRCOD, WRCODA have been moved from XR27 as these read and write to Disk
		Added: 	 New functions RXM and WXM added to read/write an XMEMORY File to/from Disk 
		
		XR25 EXT FNS
		Fixed: 	GETP and GETSUB would sometimes glitch when program size was not a multiple of 7 - bug introduced in v4.2
		Fixed:	POSA now also correctly uses alpha values in X.
		Fixed:	Filenames with embedded nulls will flag NAMEERR now (also XR28 MASS STORAGE)
		Fixed: 	ANUM was completely rewritten. It now only raises the stack if it found a number, and sets F22, it leaves 
			everything as it was if no number was found. Indirectly ANUMDEL (XR23) is now also working.
			It can now handle some pretty weird combos and for example will match HP41 on "..,,25..EE475" in all cases of F28,F29 
			If someone has a flowchart for this very powerful (and arcane) function I'd love to have it as the logic is hard to test.
 		Revised: ARCL and ANUM will both work with HEX values when DSPH (effectively FIX 15) is executed first 
		
		XR28 MASS STORAGE -SEE ALSO SPECIAL NOTES
		Added:	 New functions READXM and WRITEXM added to read/write an XMEMORY File to/from Mass Storage Volume .msv
		Changed: PRDIR and CAT 7 changed to accommodate the new items (filetypes)
 
		XR27 RVTUTILS	-SEE ALSO SPECIAL NOTES
		Fixed:	The SCANP and BARCODEP suite has been checked and revised a little. Its still a bit finicky to use the scanner 
			- zooming to position the mouse for selecting the corners of the barcode is critical. The conversion to vb.net 
			also changed the window mouse handling enough to offset the pointer so that the scanning was slightly off.
		Fixed: 	in special cases the END - C0 00 0D was compressed to C0 0D during scanning
		Changed: PUSHA/POPA pair has been changed to PUSHR nn, POPX for broader usage - ALPHA can be still be stacked by using X<> and PUSHSTK
		Added:	SHFYX, and ROTYX respecively shift or rotate the Y register as a whole, by the n bits in X, -ve values go left, +ve go right.
		Added: 	MASKR where nbits in X gives mask +from left,-from right, or bb.ee gives ee-bb+1 bits mask , + from left,- from right
		Added:	MEXTR nn where x=nbits or bb.ee as above extracts those bits from Register Y and leaves them in X
		Added:  MINSR nn where y=nbits as above, and X is a new value to INSert in the Register Z at those bits. Values are given a procrustean fit
 		Changed: the old RADDR nn is redesigned as a general purpose Address Query - QRYADR n thus saving a lot of peeking and poking
			'n (a parm 0-9) has the following meanings.
			'0 = REG 00?      	'location of REG 00		from reg c      
			'1 = END?         	'register of the end		from reg c   
			'2 = FREEBASE				'first freespace after buffers  deduced  
			'3 = BUFFERBASE			'usually STACKTOP+1		deduced
			'4 = STACKBASE			'0..39 regs			usually x038
			'5 = SCRATCH				'regMx,Misc,U,v,w		usually x033
			'6 = KEYSBASE				'start of key registers		usually x010
			'7 = Program Counter	(this instruction) in program mode, wherever in SST (BYTENR)
			'8 = XROM DBASE	(romnr in x)	XR00-31 must be loaded and contain data	 - err nonexistent
			'9 = XROM CBASE (romnr in x)	XR00-31 must be loaded and contain code	 - err nonexistent

		There has been a lot of revision in this module as a whole: Most changes are not breaking changes. 
		items moved to XR30 wre not programmable, DEBUG, SPEED% and ITIMES were but are now not programmable 
		- for these you may need to check code. The rest are renames to avoid conflict or clarify function 
		- they automatically shows up when printing or viewing a program 
		My apologies - these things normally stay fixed after release/publication.
		As I have no idea who actually uses this machine I am assuming low impact unless I am told otherwise.
		
		SUMMARY OF CHANGES XROM27
  
				v4.0																										v4.3		
						
		27,32	-RVT FCNS	A6E0																	-RVT FCNS		27,32
						
		27,33	RROM			A6E1	moved to XR30 A7BB					"?A6E1"		A6E1	27,33	Free
		27,34	RROMX			A6E2	moved to XR30 A7BC			
		27,35	RROMR			A6E3	moved to XR30 A7BD						MASKR		A6E2	27,34	New
		27,36	WRCOD nn	A6E4	moved to XR30 A7BE						MEXTR		A6E3	27,35	New
		27,37	WRCODA nn	A6E5	moved to XR30 A7BF						MINSR		A6E4	27,36	New
																												SHFYX		A6E5	27,37	New
		27,38	DEBUG			A6E6	To XR29 A75B Replacing DELAY	ROTYX		A6E6	27,38	New
		27,39	SPEED%		A6E7	To XR00 0105 now Not Prog			
		27,40	ITIMES		A6E8	To XR00 0106 now Not Prog		"?A6E7"		A6E7	27,39	Free
						
										SLLT		A6E8	27,40	New
		27,41	XEQA A		A6E9																XEQA		A6E9	27,41
		27,42	ASNA			A6EA																ASNA		A6EA	27,42
						
		27,43	STOABS nn	A6EB	renamed STOAR nn						STOAR nn	A6EB	27,43
		27,44	RCLABS nn	A6EC	renamed RCLAR nn						RCLAR nn	A6EC	27,44
		27,45	X<>ABS nn	A6ED	renamed X<>AR nn						X<>AR nn	A6ED	27,45
		27,46	RADDR nn	A6EE	redefined as QRYADR					QRYADR n	A6EE	27,46	Changed Functionality
						
		27,47	DERR			A6EF																DERR		A6EF	27,47
						
		27,48	AND nn		A6F0	renamed AND Register					ANDR nn	A6F0	27,48
		27,49	OR nn			A6F1	renamed OR Register						ORR nn	A6F1	27,49
		27,50	XOR nn		A6F2	renamed XOR Register					XORR nn	A6F2	27,50
		27,51	NOT				A6F3	renamed NOTX									NOTX		A6F3	27,51
						
		27,52	H-D				A6F4	renamed HEXDEC								HEXDEC	A6F4	27,52
		27,53	D-H				A6F5	renamed DECHEX								DECHEX	A6F5	27,53
		27,54	DSPH			A6F6																DSPH		A6F6	27,54
						
		27,55	PUSHSTK		A6F7																PUSHSTK	A6F7	27,55
		27,56	POPSTK		A6F8																POPSTK	A6F8	27,56
		27,57	PUSHR			A6F9															 PUSHR nn	A6F9	27,57	'any register can be stacked
		27,58	POPX			A6FA																POPX		A6FA	27,58	'but only popped back into X
						
		27,59	CRFLB			A6FB																CRFLB		A6FB	27,59
		27,60	GETB			A6FC	renamed GETBB									GETBB		A6FC	27,60
		27,61	PUTA			A6FD																PUTA		A6FD	27,61
		27,62	PUTB			A6FE																PUTB		A6FE	27,62
						
		27,63	"-63"			A6FF															"?A6FF"		A6FF	27,63	Free

		XR06 ASTRO2010
		Fixed - Found JMBs KEPLER routine for ASTRO2010. Understanding that routine allowed me to write a simpler one in VB for this ROM 
			which is now complete. See his documentation.

		Further work on Advantage,CCD and PANAME ROMs - still WIP but:

		Fixed: Advantage Matrix functions now all work - hopefully correctly. It can do all exercises in the manual.
			I havent yet connected the CCD and ADV Matrix calls to the common routines. so only Advantage works.

		Fixed: XMEM Files now respect FileFlags in nybble 4 of Header record 2 - needed for Matrix 
		New  : MATRIX of BYTE (8bits), WORD (16bits) or INT(32bits) can also be made with MATDIM. All advantage matrix functions 
			and XMEM respect these changes to Matrix pointer functions
			- there	are two bits not used in the header which have become fieldsize indicators. The max colums is restricted to 7 bits to 
			accommodate the storing of an excess - the difference between filesize and rows*cols*elemsize. 
			Hence we can now make arrays in bytes,uwords or uints for new purposes, in addition to their math matrix uses.  
		
		Added: The ADV MATRIX ROMs 22,24 functions as FOCAL Code - but documentation is sparse for some of the MCODE
			ADVANTAGE ROM22 will not go with ADV MATRIX ROM24 and vice-versa as some entry points and ROM Function Nrs have changed...
			The changes called from ROM22 into ROM24 break the relationship between these modules and existing code cannot use 
			the ADV MX functions without modification - this could have been avoided easily...  
			ADV MX ROM22 still needs to be pointed at the underlying Matrix routines from ADV ROM22. However in ADV MX ROM24 I'm still making 
			my mind up about supporting ROM FOCAL code called as if it where a function when the stack and ALPHA are not preserved first 
			as most functions do, particularly as the uses are mixed for no obvious reason. Also a function rolling down the stack (CHSYX) 
			instead of using LASTx and dropping it seems to break the standard - I know of no other function that does this..
 
		Added: the character functions in XROM23 HPIL ExtIO now work - as do their Paname counterparts ie ATOXL,ATOXR,ATOXX and XTOAL,XTOAR,YTOAX
			note that ATOX in Xfunctions returns 0 if ALPHA is empty, the ATOX. functions here return -1
		
		XR10 PPC0 and XR20 PPC1 
			Using the new functions and by testing all of the PPC functions for differences in behaviour between HP41C and VB41C the PPC roms are
			 now well on the way to being serviceable. Only the MK and LB routines have not been repaired.
			The main differences are caused by
			1. VB41C does not normalise anything other than rounding A-E to 9 - so some routines that rely on normalisation failed and were revised
			2. Bit twiddling in Regd really isnt tolerated well by VB41CX - there are many users of Regd and disrupting the flags has 
			   strange effects on printer and other items. Wherever possible routines using Regd have been rewritten to not need it.
			   I do not reccomend using those techniques with VB41CX - that is one of the reasons why I have made the new hex mode functions.
			3. Routines that use ARCL are not tolerant to DSPH mode (e.g. an alpha string "ABC" is turned to HEX alpha "00000000414243") and 
			   so have added FIX 4 added to change out of HEX display.
			I have added a small sheet showing what has changed in the Docs folder,. 

	DOCS	Documentation updated as necessary - but not by any means complete yet.

	SPECIAL NOTE ON ROM CHANGES:	

		- Affected modules are XR27 RVT Utils, XR30 CardReader, XR28 Mass Storage

		The main reason for this is rationalisation of the general naming convention for different IO actions
		XR28 the Mass Storage uses READ... and WRT... to designate IO to the DiskFile
		XR30 the CardReader 	uses R...    and W... 	to do IO to the OS File System
		XR25 the XFunctions 	uses GET.    and SAVE. 	to exchange data from the Main memory to XMemory

		So GETAS and SAVEAS in XFcns are actually misnomers for the READAS and WRTAS functions that couldnt be/weren't added to XROM28
		The READEM and WRTEM from Paname should also have been on XROM28 but postdate it.

		The superset I have added, WXM,RXM on CardReader, and READXM and WRTXM on Mass Storage, will execute the above functions for them
		by allowing XMEMORY Files to go to and From Disk and Disk file in a consistent manner. FILETYPE=8 will be XMEM files on MASS STORAGE
		ANY type of XMEM file is IOable this way - without needing special code for any given type. The Real filetype is in Byte(7) of the file. 
		They will be written to Disk as .41x files in the \Programs Directory. Their format will be the two XMEM header registers followed by
		their contents - with the proviso that the RRR entry in the 2nd Header Register needs to be replaced on retrieval with the new address. 		
		ALL of XMEM can be saved/retrieved (like WRTEM,READEM) at once with these functions too e.g WXM with ALPHA="*,DISKNAME"
		I also renamed RAS, WAS (Read/Write Ascii File to Disk as .txt) to RTXTA,WTXTA more explicitly matching what they do - 
		the ROM Codes stayed the same. 

		Hence some not-programmable entries have been moved about - this has no effect on Programs, but will screw up Key Assignments
		RALL,RSTS have been moved up in XR30 CardReader to make room for the new functions
		The conversion and setup functions RROM,RROMR,RROMX, (Read .rom Files from Disk) and WRCOD,WRCODA (Write ROM .COD Statefiles to Disk)
		have hence moved from XR27 RVT Utils to XR30 CARD READER.
		On XR28 MASS STORAGE the functions other than DIRX that are on XR23 HPIL Ext IO are now on XR23 only 
		which is now supported (but generally unimplemented). This allowed moving in the new functions. 

		Other changes not related to the above:
		In XR27 RVT UTILS the function block XR27,00-31 will remain reserved for PAGEQ functions and PAGEQ uses
		e.g. XR27,30 BCODEP makes barcode XR27,31 `SCANP reads a barcode program using PAGE Q. 
		I also intend to do some sort of plotter support here for XR17/18 - but still some way off as they are mostly MCODE

		XR27,32-63 will stay a bit volatile - though once in place I will stabilize it.
		The functions OR,AND,XOR,NOT in XR27 have been renamed to resolve a conflict by name with the 32bit integer functions that are in 
		XR22 ADVANTAGE. Hence they are now ANDR,ORR,XORR,NOTX and affect all 56bits of a register, and, excluding NOTX, Registers nn and IND nn. 
		Existing code will not break, just list differently
		
		The functions RCLABS,STOABS and X<>ABS have been renamed RCLAR,STOAR and X<>AR Absolute Register - AR is the real register number 
		underneath the covers in the VB41CX machine. RegT is AbsReg 0, RegX is Abs Reg 3 etc., the assignments start at AbsReg16 
		RADDR has been completely recast as a general address query and will break code using it.
  
		CRFLB will now produce a Type5 file as for all other buffer files, but with BufferID=0. - if you have these on your xmem you will ned to 
		recode the first byte of header2 from 9 to 5 - either in a hex editor, or by program. They wont break the EMDIR but will not function at
		all.
		
		The function GETB had a name conflict with GETB in CCD module so I have renamed it GETBB for now (Get BufferFile Byte). PUTA,PUTB are 
		essentially INSREC and INSCHR on a buffer file - so I may build that in there yet and drop the functions, GETBB may become built into 
		ARCLREC or GETREC.  

		Also, some experiments fail...  especially when seen retrospectively several years later.


		'============== DATA INTERCHANGE FORMATS ================================================================================================

		I am leaning to rewrite all of CARDREADER and MASS STORAGE IO to always write files in XMEM format, ie two data headers followed by data.
		This has the advantage of enabling unique file extensions, and unifying the whole Import/Export of files  between Simulators,Emulators 
		and Interfacing to real HP41s from other devices.

		I am proposing that:  
		All 41 data files exchangeable through media other than LIF filesystems, HPIL or 41 systems take on XMEM binary format

		HDR1 - 7 bytes Name right padded with spaces , no nulls
		HDR2 - 7 bytes Type  - 4bits, 
			       RegNr - 12bits=xxx (dont care)- becomes the XMEM register address
			       TypeData (whatever is needed by filetype) 16bits 
			       rrr (Record Pointer) - 12 bits ie 0-4095
			       SSS (size in Regs) 	- 12 bits	ie 1-4095 	i.e. corresponnding to their XMem uses
		followed by
		SSS Registers of data.

		All data written sequentially as a stream from first byte of hdr1 to last byte of file. 

		A major advantage of this format is that data content and metadata for its use usually kept in Header 2 is exchanged with the data.
		This allows some context (e.g. matrix layouts and buffer types to be exchanged cleanly)

		The native filesystem will deal with all other attributes like locks, timestamps etc.

		All files are then written to/read from whatever (emulated) medium is used in this form. e.g. between TABLET, PHONE, IPOD, PC, Internet 
		Support for the to be legacy format .RAW is extensive so should NOT change. It will probably never disappear, but is not unique to the 
		41 world. There is very little support for other filetypes, that I am aware of anyway. 

		Then DISK File extensions are as follows:
		Filetype
			0 - no files should use this Filetype.
			1	.41p - Program files - n bytes + CHKSUM - currently .RAW (null padded to neareset 256 byte block)
			2	.41d - Data files - n registers - contents are my current .DTA
			3	.41a - ASCII data file - n records of 1,,m chars + EOF
			4	.41m - Matrix data file - nxm elements of array data 	(BYTE,UWORD,UINT,REGISTERS by default)
			5	.41b - Buffer data File - essentially a buffer of arbitrary bytes but often with meaning for specific modules.
			6	.41k - KEY assignments - contents of registers of assignments as assigned (was .KEY) - some emulator differences here
			7*.41w - WALL files - an entire machine (was .ALL)
			8*.41x - XMemory files - an entire contents of XMemory (now all types are encapsulated see above)
			9	.41s - STS Status Cards - 32 registers (status regs and 32 assignments (was .STS)
 			A-F reserved for future use

		* TypeData should contain something identifying source (emulator) machine kind because emulators can support different sizes
		and formats of internal memory. Some sort of machine definition should also be supplied so that users may 'understand' the 
		supplied data and build IO support in their own modules.
		
		In my files TypeData will read 'VB' and the file names 411755R (WALL) and XM1755R (XMEM) corresponding to their size.	
		Both are written contiguously in Low to High Addresses in register format. The DEBUG.TXT details them.

		Alternatively perhaps .41x, .41w files should only be exchanged between owners of the same emulators, and their contents should
		be exchanged at the file level... The other filetypes are generally identical.

		Comments on this proposal are welcome mailto: rivit@tpg.com.au
		=============================================================================================================================================

 30 Aug 2012   	v4.2 4th General Public Release (Exe only) - 10yr Anniversary Edition and I am 58 today!

	GUI
		The GUI and the machine representation has been completely facelifted from images I made on a much more modern camera.
		Keyboard labels now in a new matching font (an ARIAL/HELVETICA lookalike)
		Win7 does show some artefacts after a resize (unlike XP) - moving the mouse over the glitches corrects them (why???)
		Modifications to window positioning and sizing should mean this now keeps user preferred position and 
		adapts gracefully to laptop and large screen sizes.
	CORE
		FIxed: The functions % and MOD have been fixed. These bugs dated from the original 10 years ago...
		Fixed: CLD now does that only and not CLx. 
		Fixed: PROMPT in Immediate mode now does not start a program running
		Fixed: Number parsing corrected to deal with trailing '-' sign in RAW code
		The Culture is made en-US invariant thus avoiding any number of formatting complications

		Machine is now High Endian in logical addressing - consistent with real thing. Addresses in call stack (Rega,Regb) however are
		all in bytes not regs/bytes - i.e. there is no distinction between RAM and ROM addresses - in theory then 64K can be addressed. 
		Jumps are represented as in the HP41 design. The status registers (as before) work as in the original. 
		The Memory addresses for various components are however different from the Native 41 - for instance the main machine uses all 
		register addresses from 000 to 6DA without gaps. This needs to be watched if you use Synthetic techniques to fiddle about.  
		Register Q is now never used by the simulation. 
		XMEM runs in ascending addresses (from Register 2492..2B6C) not descending as the real HP41 XMEM does - hence you cant run 
		a program in XMEM. Also, ROM addressing is HI-LOW as in main memory not LO-HI as in HP41 Land. For most purposes you will 
		never see these differences. See the debug.txt file to see how memory is organised for your setup.

		Many bugs and glitches as a consequence of the VB.NET conversion have been fixed.
		Various optimisations from VB6 era have been removed as VB.NET has better native array support
		There are now no VB6 references/dependencies.
		A couple of deep seated addressing errors in edit mode found and fixed - should be much less breakable now.
		Performance has been improved - v4.0 was way too heavy on the GUI - in fact even now GDI+ under windows dominates runtime
		and this speed-limits all display and printing functions. 
		Made improvements to the benchmarking measures so that its smarter about using available CPU power.

		If things get irrevocably screwed up - deleting the VB41.cfg and VB41c.dat files and restarting will completely reset the machine
		This is literally MEMORY LOST. Note that MEMORY LOST Does NOT clear XMEM.

	ROM
		Fixed: VIEW,AVIEW and PROMPT now display left aligned on the printer
		Fixed: SKPCOL in doublewide now skips double the columns.

		Time Module now does a few more things - and can automatically accept YYYYMMDD. formats in DATE routines.
		Also now supports SETDATE and SETIME so you can run with something other than SystemTime. Setdate=0 to reset to PC Systemtime 

		XROM27 RVTUTils 
		RROM,RROMX,RROMR functions substantially fixed and can now load almost all non machinecode ROM files.  
		Added Barcode scanning and Printing XMEM file programs to ROM. Now supports making and scanning of barcode.
	
		Added Astro2010, SPECTRAL C, and many other more esoteric roms to supported ROMs
		PPC0 and PPC1 roms have been reverted to FOCAL code for now - look out though this machine is subtly different 
	WIP
		The M-CODE Roms PANAME,CCD,ADVAPP are all in unfinished state while I work my way through Matrix Maths and other oddities -
		sometimes its extremely hard to find out how a ROM actually does things. Some other functions will work but ROMS dependent 
		on them may show "NOT IMPLEMENTED"
	
	DOCS	Documentation updated as necessary - now PDF.

 12 Aug 2012   v4.1 Major Bugfixes and restricted private release (Exe only)
 27 Sep 2011   v4.0 Converted into VB.NET. Mostly work to change gfx and gui. Most code unchanged at all
		Testing was minimal as I was not at first publically releasing this - so it may break!
		LATER NOTE: My apologies - I should not have released this version... it was too broken.

 15 Oct 2006   v3.3.321 Fully recompiled and corrected to here - 3rd General Public Release

	Core Machine
		Significant rewrite of CPU and PRGM functionality (many many adds, alters and fixes)
		Fixes around GETP,GETSUB etc and PCLPS now done, now work as intended
		Fixed a number of bugs in PRGM Mode which didn't keep positioning correct
		Found and Fixed a PACKING error which left a NULL after a number (programs now shorter if numbers used!)
		Can now define XROM funtions with parameters (3 byte codes) Parameters 1 byte or upto 15 alpha
		Substantial recombination of XROM code, and some simplification
		Fixed Display for XPSP2 and better ASN Labels
		Added a couple of new ROMs and updated a couple
		Documentation brought up to date
		Significant improvements to GUI - now three sizes, Machine, Machine + Printer , Full Screen
		The program is designed for 1280x1024 full screen and wont fit the display in smaller modes
		Better use of colour in CATALog listings and Program Listings
		Machine now times itself. with Printer on XEQ ITIMES to get a listing of times per function
		Machine is about 70-100 times faster on average than the original HP41

	Printer
		A couple of new functions, Rewrite of buffer handling to improve performance
		Enhanced printer to 16 colours, rearranged characterset, and can print barcode now. 
		Also condensed print SF18
		Enhanced PPRP if * in ALPHA will dump all of program memory to PRINTER
		Added a Printstrip File Save (ASCII) (activated by PRRIP)
		'PRCHSET now as XROM program - shows off the printer characterset and features
		'PRXFL - can print specially formatted versions of XMEM files

	Card Reader
		Expanded functionality match of Card Reader - Almost all functions now work 
		WALL and WSTS .DAT files can be read with RALL, RSTS
		Can now read .TXT programs that pass HP41uc compilation RTXTP, RTXTS (Check the Program afterwards!!)
		Also read .TXT files into ASCII XMEM files with RAS,WAS

	Time
		Basic SW functions now work, added RCLSWM to return elapsed in millisecs

	RVT PAGE Q - New XROM27		( Still in development but works quite well )
		A new Device for output - linked to Printer and in its own right. A basis for PLOTTER and DISPLAY.
		A Full Page Graphics device used to view printerstrips or other GIF,JPG or BMP files
		*PAGE can save GIFS of output.
		Can produce (BCODEP) and Scan HP41 Barcode `SCANP  as a graphic (say from flatbed scanner)
		The Plotter XR17,18 functions are not yet capable of using it (v3.4?)
				
		* This is a page comprising n printstrips (or full page GFX), sized to be printed on a 600dpi printer at 8x11 inch.
		This gives a pretty good print of a program or results. Its only a 16 colour print but as its gfx
		it'll be a slow print. Offline a good program like IrfanView can be used to browse output at 2x2 
		size - unless you can read the originals (I cant)

	RVT FCNS   - New XROM27 (moved from CardReader)
		Better reading of .ROM files - RDROM4K, RDROM8K, RDROMR (see manual)
	  	Enhanced .COD file writing WRCOD - the basic module still needs to be written to use the .COD file
		However if the module is entirely user code then the WRCODA function can write an auto configuring .COD file
		the name of which should go in the AUTOXROM.txt file
		Added functions for addressing Absolute registers, and PUSH/POP for Stack and ALPHA
		Added Functions to create and maintain a BYTE buffer in XMEM
	PPC	PPC Module now reverted to UserCode - heavily modified (probably not everything yet) to use this machine

			
 11 Jun 2006	v3.2.54	Interim version released to Hp41.org, and privately - watch this space
		
 11 Oct 2004	v3.2.36	Fully recompiled and corrected to here - 2nd General Public Release

	XFN Machine can now be very large compared to the original (max 64K)
	XFN Support for Most ROMS is now added under the  Button one can completely reconfigure the machine
	As always support is incomplete and best for those not containing MachineCode in the XROM
	No more requirement for separate dll for functions - this will be slower on older machines - but still quick
	and now leaves a cleaner, less invasive install.
	Fixed overflow error under NT,XP and faster machines (TimerFreq is ClockFreq/5E6 in Win98, ClockFreq/1E4 in XP) 
	A few more fixes with SumRegs, and other crazies
	Quick Ref Manual updated

 21 Oct 2002	v3.1.32	Fully recompiled and corrected to here - First General Public Release

	Remaining ROMs except 05 Standard, 21-31 Data Acquisition added 
	A few more fixes

 29 Sep 2002	v3.1.17	Fully recompiled and corrected to here	- Not released

	further integration of dll for maths strings, and CPU functions
	 - original source left commented in the source
	 - wrote QuickRef Guide, split release zips and help file zip 
	   2nd, WWW.HP41.ORG release

	CPU 	    	- now mostly in DLL
	Display.bas - no major fixes
	HP41CX	    - fixed duplicate display of instruction preview
							- fixed the stack enable in ENTER, + sequence
							- added call to XROM code
	Parser	    - a couple of minor tweaks
	PRGM	    	- MAKEROM function support, calling XROM code
							- fixes in GTO, XEQ and RTN, END
	XFn	    		- added xAF - aL ALPHA Load bytes
								added xB0 - bL Byte load from alpha
								added MAKEROM - all not programmable
								ROLLUP and ROLLDOWN were reversed - fixed
	PRINTER	    - now fully implemented - no font needed all drawn in
								custom-made listview. All functions supported
								ADDED some IL 82163 printer functions
								ADDED - 8 color support for ink - ACINK (x=0 to 7)
	CARDREADER  - fixed in Rom Reading code, will show directory of a V41 ROM 
	XROMS	    	- PPC0, PPC1 Added, many functions in PPC0 implemented as intrinsics
							- ADDED Maths 1C, Stats 1B, Survey 1B, Finance 1B - all run
								some better than others 
	HELPFILES   - an A5 MSWord (printable) Quick Reference has been prepared

 3 Sep 2002	v3.1.01	Fully recompiled and corrected to here - Not Released

	dll now fully integrated into operation - increased speed
	many fixes all over the place

 22 Aug 2002	v3.0.57 WINNT Fixes - had to revert to a DLL for Callback to work properly

 19 Aug 2002	v3.0.45	This is VERY much an ALPHA edition - First Restricted Release
  
Earlier versions existed on an Amiga machine back in '1988/89

Bug reports and ideas for inclusion should be directed at rivit@tpg.com.au, preferably with some supporting documentation. 

Questions related to how to use an HP calculator I leave for you to solve, there's plenty of material on www.hp41.org to help you there,
as well as on many other web sites. 

Problems with other Windows platforms will be hard for me to solve alone -
- I'm still on XPSP3 on a 3.2GHz Dell Machine from 2004 - but it hasnt got long to go...
- this got replaced in May 2013 with a very nice machine (even now 4 years later) - home built Intel 3570K + 16GB DDR3 + AMD 7870 2GB Gfx + Samsung 256GB SSD
	cheers Ron



 

 